import React from 'react'
import PropTypes from 'prop-types'
import Component, { mapStateToProps, mapDispatchToProps } from '@components/Component'
import { connect } from 'react-redux'
import Approve from '@components/ApprovePre/Index'

class UnAccept extends Component {
  render () {
    if (!this.props.caseDetail.cause_action) {
      return <span>请先完善案件信息</span>
    }
    return (
      <div>
        <Approve
          caseDetail={this.props.caseDetail}
          flowKey='buyushouli'
          afterAction={(instance, action) => this.props.refreshCaseData()}
          creatable={this.props.editable}
        />
      </div>
    )
  }
}

UnAccept.propTypes = {
  caseDetail: PropTypes.object,
  // active: PropTypes.bool,
  // refreshCaseData: PropTypes.func
  editable: PropTypes.bool
  // fileList: PropTypes.array
  // getFileList: PropTypes.func
}
UnAccept.defaultProps = {
  caseDetail: {},
  active: false,
  refreshCaseData: () => {},
  editable: false,
  fileList: [],
  getFileList: () => {}
}

const mapState = mapStateToProps(function (state) {
  return {
    userInfo: state.basic.userInfo
  }
})

const mapDispatch = mapDispatchToProps(function (dispatch) {
  return {

  }
})

export default connect(mapState, mapDispatch)(UnAccept)
